<?php
/**
 * ProjectName: Grapes.
 * Created by LemonZ.
 * FileName: OperationLog.php
 * Date: 2019/2/14
 * Time: 4:33
 * Description:
 */

namespace app\admin\controller;


use app\common\controller\Admin;
use app\common\model\OperationLog as LogModel;
use think\facade\Request;

class OperationLog extends Admin
{
    /**
     * @return mixed
     * @throws \think\exception\DbException
     */
    public function index()
    {
        $logModel = new LogModel();
        if(Request::isAjax())
        {
            $request = input('param.');
            return $logModel->tableData($request);
        }
        return $this->fetch();
    }

    /**
     * @return mixed
     * @throws \think\exception\DbException
     */
    public function getLastLog(){
        $logModel = new LogModel();
        $request['limit'] = 10;//最近10条数据
        return $logModel->tableData($request);
    }

    /**
     * 后台操作日志记录列表
     * @return mixed
     * @throws \think\exception\DbException
     */
    public function logList ()
    {
        if (Request::isAjax()) {
            $logModel = new logModel();
            return $logModel->tableData($this->request->param());
        }
        return $this->fetch('list');
    }
}